package com.zjl.paike2.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zjl.paike2.entity.TeacherInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 教师信息Mapper接口
 */
@Mapper
public interface TeacherInfoMapper extends BaseMapper<TeacherInfo> {
    
    /**
     * 查询教师列表（关联学院表查询学院名称）
     */
    @Select("SELECT t.teacher_code, t.teacher_name, t.teacher_title, t.sex, t.college_no, c.college_name FROM teacher_info t LEFT JOIN college_info c ON t.college_no = c.college_no")
    List<TeacherInfo> selectTeacherList();
    
    /**
     * 根据教师编号查询教师信息（关联学院表查询学院名称）
     */
    @Select("SELECT t.teacher_code, t.teacher_name, t.teacher_title, t.sex, t.college_no, c.college_name FROM teacher_info t LEFT JOIN college_info c ON t.college_no = c.college_no WHERE t.teacher_code = #{teacherCode}")
    TeacherInfo selectTeacherByCode(@Param("teacherCode") String teacherCode);
} 